package com.freedom.bean.core;

import java.io.Serializable;

import org.apache.commons.lang3.StringUtils;

import com.freedom.sys.UserUtils;
import com.freedom.util.sys.DateTimeUtil;

/**
 * 公共属性
 * @author huguangjun
 *
 */
public abstract class DataBean extends BaseBean implements Serializable {
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	protected String id; //主键
	protected SysUser createBy; //创建者
	protected String createDate; //创建时间
	protected SysUser updateBy; //更新者
	protected String updateDate; //更新时间
	protected String remarks; //备注信息
	protected String delFlag; //删除标记（0：正常；1：删除）
	
	public DataBean(){
		super();
	}

	/**
	 * 添加数据之前
	 */
	@Override
	public void preInsert(){
		SysUser user = UserUtils.getUser();
		if (StringUtils.isNotBlank(user.getId())){
			this.createBy = user;
			this.updateBy = user;
		}
		this.updateDate = DateTimeUtil.getDateTime();
		this.createDate = updateDate;
	}

	/**
	 * @return the id
	 */
	public String getId() {
		return id;
	}

	/**
	 * @param id the id to set
	 */
	public void setId(String id) {
		this.id = id;
	}

	/**
	 * @return the createBy
	 */
	public SysUser getCreateBy() {
		return createBy;
	}

	/**
	 * @param createBy the createBy to set
	 */
	public void setCreateBy(SysUser createBy) {
		this.createBy = createBy;
	}

	/**
	 * @return the createDate
	 */
	public String getCreateDate() {
		return createDate;
	}

	/**
	 * @param createDate the createDate to set
	 */
	public void setCreateDate(String createDate) {
		this.createDate = createDate;
	}

	/**
	 * @return the updateBy
	 */
	public SysUser getUpdateBy() {
		return updateBy;
	}

	/**
	 * @param updateBy the updateBy to set
	 */
	public void setUpdateBy(SysUser updateBy) {
		this.updateBy = updateBy;
	}

	/**
	 * @return the updateDate
	 */
	public String getUpdateDate() {
		return updateDate;
	}

	/**
	 * @param updateDate the updateDate to set
	 */
	public void setUpdateDate(String updateDate) {
		this.updateDate = updateDate;
	}

	/**
	 * @return the remarks
	 */
	public String getRemarks() {
		return remarks;
	}

	/**
	 * @param remarks the remarks to set
	 */
	public void setRemarks(String remarks) {
		this.remarks = remarks;
	}

	/**
	 * @return the delFlag
	 */
	public String getDelFlag() {
		return delFlag;
	}

	/**
	 * @param delFlag the delFlag to set
	 */
	public void setDelFlag(String delFlag) {
		this.delFlag = delFlag;
	}
	
}
